package com.liuhe.demo2;

public class Demo1 {
    public static void main(String[] args) {
        String name = "17882203167";
        //验证电话号码
        boolean result = name.matches("[1-9]\\d{10}");
        System.out.println(result);
        //身份证
        String idcard = "51234519970301143X";
        boolean result2 = idcard.matches("[1-9]\\d{5}(18|19|20)\\d{2}(0[1-9]|1[012])(0[1-9]|[12]\\d|3[01])\\d{3}[0-9Xx]");
        System.out.println(result2);


    }
    
}

